/*
 * @Description:
 * @Autor: lcz
 * @Date: 2022-07-14 14:13:02
 * @LastEditors: lcz
 * @LastEditTime: 2022-07-14 16:55:29
 */

import { createElement, CSSProperties } from 'react'
import create, { BuildinIconScriptUrl, loadIconLib } from './iconFont/iconFont'

const IconFont = create()

export interface AntIconComponentProps {
  name?: string
  class?: string
  style?: CSSProperties | undefined
  tabIndex?: number
  icon?: string
  iconSourceList?: string[]
  spin?: boolean
  rotate?: number
}

const IconComponent = (props: AntIconComponentProps) => {
  loadIconLib(props.iconSourceList ? props.iconSourceList : BuildinIconScriptUrl)

  return (
    <IconFont
      type={'icon-' + props.icon}
      name={props.name}
      className={props.class}
      style={props.style}
      tabIndex={props.tabIndex}
      spin={props.spin}
      rotate={props.rotate}
      
    />
  )
}
export default IconComponent
